import { GSprite } from "../../../../../com/mui/controls/GSprite";
import { IToolTipItem } from "../../../../../com/mui/manager/IToolTipItem";
import { ObjCreate } from "../../common/ObjCreate";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { Language } from "../../../../../extend/language/Language";
import { SRobCityThreeJoinTeam } from "../../../../../Message/Public/SRobCityThreeJoinTeam";
import { RobCityUtill } from "../RobCityUtill";
import { EntityUtil } from "../../../scene/layer/utils/EntityUtil";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { ToolTipsManager } from "../../../../../com/mui/manager/ToolTipsManager";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
//class RobCityStepThreeGuildItem
    
    export  class RobCityStepThreeGuildItem extends GSprite implements IToolTipItem
    {
        constructor()
        {
            super();
            this._serverLabel = ObjCreate.createGTextField("", 5, 15, 150, 20, this, GlobalStyle.textFormat6);
            this._nameLabel = ObjCreate.createGTextField("", 5, 35, 150, 20, this, GlobalStyle.textFormat6);
            this._serverLabel.htmlText = Language.getStringByParam(60932, " -- -- ");
            this._nameLabel.htmlText = Language.getStringByParam(60943, " -- -- ");
            return;
        }

        public updateInfo(arg1: SRobCityThreeJoinTeam): void
        {
            var loc1=false;
            var loc2=null;
            if (arg1) 
            {
                loc1 = RobCityUtill.checkHasUnion(arg1.guildUnion);
                this._serverLabel.htmlText = Language.getStringByParam(60932, EntityUtil.getProxyName(arg1.sEntityId));
                this._nameLabel.htmlText = Language.getStringByParam(60943, arg1.guildName);
                loc2 = "";
                loc2 = loc2 + (HTMLUtil.addColor(Language.getStringByParam(60932, EntityUtil.getProxyName(arg1.sEntityId)), GlobalStyle.color6) + "\n");
                loc2 = loc2 + (HTMLUtil.addColor(Language.getStringByParam(60943, arg1.guildName), GlobalStyle.color6) + "\n");
                if (loc1) 
                {
                    if (arg1.guildUnion.secondGuildId > 0) 
                    {
                        loc2 = loc2 + (HTMLUtil.addColor(Language.getStringByParam(60988, arg1.guildUnion.secondGuildName), GlobalStyle.color4) + "\n");
                    }
                    if (arg1.guildUnion.thirdGuildId > 0) 
                    {
                        loc2 = loc2 + (HTMLUtil.addColor(Language.getStringByParam(60988, arg1.guildUnion.thirdGuildName), GlobalStyle.color4) + "\n");
                    }
                }
                this.toolTipData = loc2;
                ToolTipsManager.register(this);
            }
            else 
            {
                this._serverLabel.htmlText = Language.getStringByParam(60932, " -- -- ");
                this._nameLabel.htmlText = Language.getStringByParam(60943, " -- -- ");
                this.toolTipData = null;
                ToolTipsManager.unregister(this);
            }
            return;
        }

        public get toolTipData()
        {
            return this._toolTipData;
        }

        public set toolTipData(arg1)
        {
            this._toolTipData = arg1;
            return;
        }

        /* internal */ /* var */_serverLabel: GTextFiled;

        /* internal */ /* var */_nameLabel: GTextFiled;

        /* internal */ /* var */_toolTipData;
    }
